package com.software.usercenter.feignclient;

import cn.hutool.json.JSONObject;
import com.software.usercenter.domain.Result;
import com.software.usercenter.entity.Answer;
import com.software.usercenter.entity.Question;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Author: zk
 * Description: 调用问题中心的客户端
 */
@FeignClient(name="question-center")
public interface QuestionCenterFeignClient {
    //发布题解的方法
    @PostMapping("/question/publishAnswer")
    JSONObject insertAnswer(Answer answer);
    //查看题解列表的方法 根据题目id获取是哪个题的答案
    @GetMapping("/question/queryAnswerList")
    JSONObject queryAnswerList(@RequestParam("questionId") Integer questionId, @RequestParam("page") Integer page, @RequestParam("size")Integer size);
    //查看具体题解的方法
    @GetMapping("/question/queryAnswer/{answerId}")
    JSONObject queryAnswer(@PathVariable String answerId);

    //发布题目
    @PostMapping("/question/createQuestion")
    Result createQuestion(Question question);

    //删除题目
    @PostMapping("/question/deleteQuestion")
    Result deleteQuestion(Question question);
    //修改题目
    @PostMapping("/question/updateQuestion")
    Result updateQuestion(Question question);

    // 根据题目id查询某一个题
    @GetMapping("/question/findQuestion/{questionId}")
    JSONObject findById(@PathVariable Integer questionId);

    @GetMapping("/question/findQuestionNums")
    JSONObject findQuestionNums();
}
